﻿Partial Class Document

    Public ReportHeader As New Body

    Sub Clear()
        Info = Nothing
        EndSection()
    End Sub

    Sub New()
        InitializeComponent()
        ToolStrip.Renderer = New Renderer
        TabStrip.Renderer = New Renderer
    End Sub

    Public Sections As New List(Of Section)

    Sub EndSection()
        Sections.Add(New Section With {.Document = Me})
    End Sub

    ReadOnly Property CurrentSection() As Section
        Get
            Return Sections(Sections.Count - 1)
        End Get
    End Property

    ReadOnly Property Header() As Body
        Get
            Return CurrentSection.Header
        End Get
    End Property

    ReadOnly Property Detail() As Body
        Get
            Return CurrentSection.Detail
        End Get
    End Property

    Sub Print(ByVal Info As PrintInfo)
        ReportHeader.Print(Info)
        For Each Section As Section In Sections
            Section.Print(Info)
        Next
        Info.Cleanup()
    End Sub

End Class
